<?php

function iconvObj($obj, $incharset, $outchareset) {
	if (is_array($obj)) {
		foreach ($obj as $k=>$v) {
			if (is_array($obj[$k])) {
				$obj[$k]=iconvObj($obj[$k], $incharset, $outchareset); 
			} else { 
				$obj[$k] = iconv($incharset, $outchareset, $obj[$k]);
			}
		}
	}
	return $obj;
}

function getFormattedDate($timestamp) {
	return date("d.m.Y H:i:s",$timestamp);
}

function MyStrToTime($str) {
	list($date, $time) = explode(" ", $str, 2);
	list($day, $month, $year) = explode(".", $date, 3);
	list($hh, $mm, $ss) = explode(":", $time, 3);
	return mktime($hh, $mm, $ss, $month, $day, $year);
}

function getTownsOptionList() {
	$towns = new Towns();   
	$townsList = $towns->getTowns();
	$list = ""; 
	foreach ($townsList as $town) {
		$list .= "<option value='".$town->id."'".($town->isdef?" selected":"").">".$town->title."</option>";
	}
	return $list;
}

function getServiceTypes($id) {
	global $serviceTypes;
	return $arr[$id];
}

function getProdCategory($id) {
	global $prodCategories;
	return $arr[$id];
}

?>